package com.weibo4j.api.response.favourite;

import com.weibo4j.api.WeiboResponse;
import com.weibo4j.api.domain.Tag;
import com.weibo4j.api.json.JSON;

public class TagGetResponse extends WeiboResponse<Tag>{
    
    private Tag model;

    public Integer getTotalNumber() {
        return result.getInteger("total_number");
    }

    @Override
    public Tag getModel() {
        if (success && model == null) {
            isSuccess();
        }
        return model;
    }

    @Override
    public boolean isSuccess() {
        boolean isSuccess = super.isSuccess();
        if (isSuccess && model == null) {
            model = JSON.parseObject(jsonString, Tag.class);
        }
        return isSuccess;
    }
}
